home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 May / maximum-cd-1999-05.iso / Canvas 6 / DATA1.CAB / English_Tutorial_Files / Viewpage / DrawEng.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-04  |  1.6 KB  |  79 lines

  1. import java.awt.Graphics;
  2. import java.awt.Rectangle;
  3.  
  4. public final class DrawEng implements Runnable {
  5.    public ColadaDoc m_theDoc;
  6.    public Colada m_appComp;
  7.    public Rectangle clipRect;
  8.    public boolean inDrawAll;
  9.    private boolean startDrawAll;
  10.    private boolean stopWhile;
  11.  
  12.    public void DoDrawAll(Rectangle var1) {
  13.       if (this.inDrawAll && this.clipRect != null) {
  14.          this.clipRect.union(var1);
  15.       } else {
  16.          this.clipRect = new Rectangle(var1.x, var1.y, var1.width, var1.height);
  17.       }
  18.  
  19.       this.startDrawAll = true;
  20.    }
  21.  
  22.    DrawEng(Colada var1, ColadaDoc var2) {
  23.       this.m_theDoc = var2;
  24.       this.m_appComp = var1;
  25.    }
  26.  
  27.    public void whileLoop() {
  28.       while(true) {
  29.          if (!this.m_appComp.m_stopCalled) {
  30.             try {
  31.                Thread.sleep(20L);
  32.             } catch (InterruptedException var1) {
  33.             }
  34.  
  35.             if (!this.stopWhile) {
  36.                if (!this.stopWhile && this.m_appComp.m_colDocDone && !this.m_appComp.m_stopCalled) {
  37.                   this.m_appComp.CallMediaObjects();
  38.                }
  39.  
  40.                if (!this.stopWhile && this.startDrawAll) {
  41.                   this.startDrawAll = false;
  42.                   this.inDrawAll = true;
  43.                   this.drawAll();
  44.                   this.inDrawAll = false;
  45.                   continue;
  46.                }
  47.  
  48.                this.m_appComp.m_breakDrawAll = false;
  49.                this.inDrawAll = false;
  50.                continue;
  51.             }
  52.  
  53.             this.stopWhile = false;
  54.          }
  55.  
  56.          this.m_appComp.m_drawEngThread = null;
  57.          return;
  58.       }
  59.    }
  60.  
  61.    public void StopWhile() {
  62.       this.stopWhile = true;
  63.    }
  64.  
  65.    public void drawAll() {
  66.       Graphics var1 = this.m_appComp.getGraphics();
  67.       if (this.clipRect != null) {
  68.          var1.clipRect(this.clipRect.x, this.clipRect.y, this.clipRect.width, this.clipRect.height);
  69.       }
  70.  
  71.       this.m_theDoc.m_colGraphicObj.drawAll(var1);
  72.       this.clipRect = null;
  73.    }
  74.  
  75.    public void run() {
  76.       this.whileLoop();
  77.    }
  78. }
  79.